﻿namespace CleanArchitecture.Infrastructure.Configuration
{
    /// DavidLee 2019/11/23
    /// 将所有用到的缓存Key集中管理，避免因为Key重复而无法获取到数据
    public static partial class DefaultCacheConfig
    {
        /// <summary>
        /// Gets a key for caching
        /// </summary>
        public static string SettingsAllCacheKey => "DefaultCache.setting.all";

        /// <summary>
        /// Gets a key pattern to clear cache
        /// </summary>
        public static string SettingsPatternCacheKey => "DefaultCache.setting.";

        #region SystemModule CacheKey
        public const string SystemNaviMenu = "Nowa.SystemNaviMenu";
        //cache userid
        public const string SystemNaviMenuByUser = "Nowa.SystemNaviMenu.AdminUserId-{0}";
        #endregion

        #region Generic attributes

        /// <summary>
        /// Gets a key for caching
        /// </summary>
        /// <remarks>
        /// {0} : entity ID
        /// {1} : key group
        /// </remarks>
        public const string GenericAttributeCacheKey = "Nowa.genericattribute.{0}-{1}";

        /// <summary>
        /// Gets a key pattern to clear cache
        /// </summary>
        public const string GenericAttributePrefixCacheKey = "Nowa.genericattribute.";

        #endregion

        #region AdminUser CacheKey
        public const string AdminUserPasswordLifetimeCacheKey = "AdminUser.passwordlifetime-{0}";
        public const string AdminRolesAllCacheKey = "AdminUser.AdminRolesAll";
        public const string AdminUserPermissionRecord = "AdminUser.AuthorizedModule.{0}.{1}";
        public const string AdminUserPermissionButton = "AdminUser.AuthorizedModuleButton.{0}.{1}.{2}";
        public const string AdminUserColumnPermissionRecord = "AdminUser.ColumnAuthorized.{0}.{1}";
        public const string AdminUserColumnPermissionButton = "AdminUser.AuthorizedColumnButton.{0}.{1}.{2}";
        //Cache adminuser Id
        public const string AdminUserIsAdmin = "AdminUserIsAdmin.{0}";
        #endregion

        #region SystemDataDic Cachekey
        public static string SystemDataDicTreeAllCacheKey = "SystemManage.SystemDataDicTreeAllCacheKey";
        public static string SystemDataDicTreeCacheKeyByGroup = "SystemManage.SystemDataDicTreeCacheKey.{0}";
        //缓存通过数据字典分配给每个系统模块的操作按钮 cache adminuser id, system moduleid
        public static string SystemModuleAssignedButtonsCacheKey = "SystemModuleAssignedButtons.{0}.{1}";
        // cache adminrole id
        public static string SystemModuleAuthorizedCacheKey = "SystemModuleAuthorizedCacheKey.{0}";
        // cache adminrole id, columntype
        public static string ColumnAuthorizedCacheKey = "ColumnAuthorizedCacheKey.{0}.{1}";
        #endregion

        #region Business CacheKey
        public const string HotBlogsCacheKey = "Business.HotBlogs";
        public const string ColumnListCacheKeyAll = "Business.ColumnMenusAll";
        public const string ColumnListCacheKeyByRoles = "Business.ColumnMenus.{0}";
        #endregion
        //Cache LanguageId
        public const string LanguageCacheKey = "SupportLanguages";
    }
}